﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Logo.aspx.cs" Inherits="UCenter.Web.Views.Account.Logo"%>

<asp:content id="Content1" contentplaceholderid="head" runat="server">
 <script type="text/javascript" src="/Content/jquery.json-1.2.js"></script>
 <script type="text/javascript" src="/Content/ajaxfileupload.js"></script>
 <script type="text/javascript">
	function ajaxFileUpload()
	{
		$("#loading")
		.ajaxStart(function(){
			$(this).show();
		})
		.ajaxComplete(function(){
			$(this).hide();
		});

		$.ajaxFileUpload
		(
			{
				url:'UploadLogo',
				secureuri:false,
				fileElementId:'fileToUpload',
				dataType: 'json',
				success: function (data, status)
				{
					if(typeof(data.error) != 'undefined')
					{
						if(data.error != '')
						{
							alert(data.error);
						}else
						{
							$('#logoImg').attr('src',data.fileName);
						}
					}
				},
				error: function (data, status, e)
				{
					alert(e);
				}
			}
		)
		
		return false;

	}
 </script>	
</asp:content>
<asp:content id="Content2" contentplaceholderid="MainContent" runat="server">
<h2><img src='/Themes/Standard/Images/ico_grsz.gif' align="middle"/>头像设置</h2>
<br />
 <%if (ViewData["User"] != null) {%>
<table cellpadding="5" cellspacing="5" width="100%">
<tr>
   <td width="50%">
   <div style="padding:5px;border-bottom-width:1px;border-bottom-color:ActiveBorder; border-bottom-style:solid;width:95%;"><h4>当前头像</h4></div>
   <div class="l120_s" style="margin:10px;"><img id='logoImg' src='<%=((UCenter.BusinessContract.AccountContract)ViewData["User"]).LogoUrl%>' /></div>
   </td>
   <td valign="top">
    <div style="padding:5px;border-bottom-width:1px;border-bottom-color:ActiveBorder; border-bottom-style:solid;width:95%;"><h4>更换头像</h4></div>
   <div  style="margin:10px;">请选择新的照片文件，文件需小于2.5MB<br />
   <img id="loading" src="/Content/Images/loading.gif" style="display:none;">
	 <form name="form" action="" method="POST" enctype="multipart/form-data">
		<table cellpadding="5" cellspacing="5">		
		  <tbody>	
			<tr>
				<td><input id="fileToUpload" type="file" size="45" name="fileToUpload"></td></tr>
		  </tbody>
		  <tfoot>
				<tr>
					<td><button id="buttonUpload" onclick="return ajaxFileUpload();">上传</button></td>
				</tr>
		 </tfoot>	
	    </table>
     </form>    	
   </div>
   </td>
</tr>
</table>
 <%} %>
</asp:content>
